<?php

namespace App\Modules\Apicrzs\Services\Water;

use App\Modules\Admin\Entities\Equipment\EquipmentParamsFreeModel;
use App\Modules\Apicrzs\Entities\ApparatusModel;
use App\Modules\Apicrzs\Entities\UserScoreModel;
use App\Modules\Apicrzs\Services\BaseServices;
use App\Traits\CryptAES;

class EquipmentFreeService extends BaseServices
{
    public function __construct(EquipmentParamsFreeModel $model)
    {
        $token = \request()->header('token');
        $user_info = CryptAES::decryptToken($token, 'user_grzq');
        $this->user_id = $user_info['data']['user_id'] ?? "";
        $this->model = $model;
        $this->userScoreModel = new UserScoreModel();
    }
    public function getFreeList($params)
    {
        $apparatusId = $params['apparatus_id'];
        $rest = $this->model->where(['water_id'=>$apparatusId])->get(['water_id','water_name','equipment_id','money'])->toArray();
        return $rest;
    }

}
